const express = require('./myexpress')
const app = express()
app.listen(3000)

// 中间件多一个next向下执行的回调方法
app.get('/home', (req, res, next) => {
  console.log('home1')
  // req/res
  req.uname = '我是张三'
  next()
}, (req, res, next) => {
  req.age = 20
  console.log('home2')
  next()
})

app.get('/home', (req, res) => {
  console.log('home3')
  res.writeHeader(200, {
    'content-type': "text/html;charset=utf-8"
  })
  res.end('home page' + req.uname + req.age)
})

